﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlLogin.ascx.cs" Inherits="Usercontrol_ControlLogin" %>
<link rel="stylesheet" href='<%=ResolveUrl("~/Css/FormLayout.css")%>' type="text/css" />
<script src='<%=ResolveUrl("~/Scripts/Vibrate.js")%>' type="text/javascript"></script>


<script type="text/javascript">
    $().ready(function () {
        $("#btLogin").click(function () {
            $.ajax({
                type: "POST",
                url: '<%=ResolveUrl("~/Webservice/WebService.asmx/CheckAccount")%>',
                data: "{'uid':'" + $("#txtUserName").val() + "','pwd':'" + $("#txtPass").val() + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    Check(data.d);
                }
            });
        });
    });

    function Check(data) {
        if (data != 'Null') {
            $("#myDiv").text("");
            $('#myDiv').bind('click', function () { (window.open('<%=ResolveUrl("~/Page/ThongTinChung/Default.aspx")%>', '_self')); });
            $("#myDiv").trigger('click');
        }
        else {
            var conf = {
                frequency: 5000,
                spread: 5,
                duration: 600
            };
            $("#login").vibrate(conf);
            $("#myDiv").text("Tài khoản không hợp lệ");
           
        }
    }


</script>
         <div class="form" id="login">
            <h1>Đăng nhập vào hệ thống</h1>

                      <fieldset>
                        <legend accesskey="B"><span style="text-decoration: underline;">Đ</span>ăng nhập</legend>
                        <label for="billingName">Tên đăng nhập:</label>
                          <input id="txtUserName" type="text" />
                        <br/>
                        <label for="billingAddress">Mật khẩu:</label>
                        <input id="txtPass" type="password"/>
                        <br/>
                      </fieldset>
        <div id="buttons">
            <input id="btLogin" type="button" class="siteButton" value="Đăng nhập" />
         </div>
         <div id="myDiv"></div>
  </div>

